// https://github.com/iconify/iconify/tree/main/components/vue
// https://icon-sets.iconify.design

import { useI18n } from '@/hooks/web/useI18n';
export const getRouter = () => {
  const { t } = useI18n();
  return {
    // 静态常用路由
    constantRoute: [
      {
        path: '/login',
        name: 'Login',
        component: () => import('@/views/login/index.vue'),
        meta: {
          title: 'router.login',
          hidden: true,
          icon: 'ep:promotion'
        }
      },
      {
        path: '/',
        component: () => import('@/layout/index.vue'),
        name: 'layout',
        meta: {
          title: '',
          hidden: false,
          ioc: ''
        },
        redirect: '/home',
        children: [
          {
            path: '/home',
            name: 'Home',
            component: () => import('@/views/home/index.vue'),
            meta: {
              title: t('router.dashboard'),
              hidden: false,
              icon: 'ic:baseline-home',
              affix: true
            }
          }
        ]
      },
      {
        path: '/401',
        name: '401',
        component: () => import('@/views/error/401/index.vue'),
        meta: {
          title: '401',
          hidden: true
        }
      },
      {
        path: '/404',
        name: '404',
        component: () => import('@/views/error/404/index.vue'),
        meta: {
          title: '404',
          hidden: true,
          icon: 'tabler:error-404-off'
        }
      },
      {
        path: '/403',
        name: '403',
        component: () => import('@/views/error/403/index.vue'),
        meta: {
          title: '403',
          hidden: true
        }
      },
      {
        path: '/500',
        name: '500',
        component: () => import('@/views/error/500/index.vue'),
        meta: {
          title: '500',
          hidden: true
        }
      },
      {
        path: '/screen',
        component: () => import('@/views/screen/index.vue'),
        name: 'Screen',
        meta: {
          hidden: false,
          title: t('router.screen'),
          icon: 'ep:platform'
        }
      },
      {
        path: '/canvas',
        component: () => import('@/views/canvas/index.vue'),
        name: 'canvas',
        meta: {
          hidden: true,
          title: t('router.canvas'),
          icon: 'ep:platform'
        }
      }
    ],
    // 异步路由
    asyncRoute: [
      {
        path: '/base',
        component: () => import('@/layout/index.vue'),
        name: 'Base',
        meta: {
          title: t('router.permission'),
          icon: 'material-symbols:lock',
          permission: 'Panda.Net.Basic'
        },
        redirect: '/base/user',
        children: [
          {
            path: '/base/user',
            component: () => import('@/views/base/user/index.vue'),
            name: 'User',
            meta: {
              title: t('router.user'),
              icon: 'lets-icons:user-fill',
              permission: 'Panda.Net.Basic.Users'
            }
          },
          {
            path: '/base/role',
            component: () => import('@/views/base/role/index.vue'),
            name: 'Role',
            meta: {
              title: t('router.role'),
              icon: 'carbon:user-role',
              iconify: '',
              permission: 'Panda.Net.Basic.Roles'
            }
          },
          {
            path: '/base/permission',
            component: () => import('@/views/base/permission/index.vue'),
            name: 'Permission',
            meta: {
              title: t('router.menuManagement'),
              icon: 'teenyicons:menu-solid',
              permission: 'Panda.Net.Basic.Menus'
            }
          },
          {
            path: '/base/organization',
            component: () => import('@/views/base/organization/index.vue'),
            name: 'organization',
            meta: {
              title: t('router.organization'),
              icon: 'clarity:organization-line',
              permission: 'Panda.Net.Basic.Organizations'
            }
          },
          {
            path: '/base/tenant',
            component: () => import('@/views/base/tenant/index.vue'),
            name: 'tenant',
            meta: {
              title: t('router.tenant'),
              icon: 'clarity:host-line',
              permission: 'Panda.Net.Basic.Tenants'
            }
          }
        ]
      },
      {
        path: '/sys',
        component: () => import('@/layout/index.vue'),
        name: 'Sys',
        meta: {
          title: t('router.system'),
          icon: 'grommet-icons:system',
          permission: 'Panda.Net.Basic'
        },
        redirect: '/sys/user',
        children: [
          {
            path: '/base/announcement',
            component: () => import('@/views/system/announcement/index.vue'),
            name: 'announcement',
            meta: {
              title: t('router.announcement'),
              icon: 'mdi:announcement',
              permission: 'Panda.Net.Basic.Announcements'
            }
          },
          {
            path: '/sys/dict',
            component: () => import('@/views/system/dict/index.vue'),
            name: 'Dict',
            meta: {
              title: t('router.dict'),
              icon: 'streamline:dictionary-language-book-solid',
              permission: 'Panda.Net.Basic.DataDictionary'
            }
          },
          {
            path: '/sys/dict-item/:id',
            component: () => import('@/views/system/dict/item/index.vue'),
            name: 'DictItem',
            meta: {
              title: t('router.dictItme'),
              icon: 'material-symbols:dictionary',
              permission: 'Panda.Net.Basic.DataDictionary',
              hidden: true
            }
          }
        ]
      },
      {
        path: '/workflow',
        component: () => import('@/layout/index.vue'),
        name: 'Work',
        meta: {
          title: t('router.workflow'),
          icon: 'mdi:workflow-outline',
          permission: 'Panda.Net.Basic'
        },
        redirect: '/workflow/list',
        children: [
          {
            path: '/workflow/list',
            component: () => import('@/views/workflow/list/index.vue'),
            name: 'WorkflowList',
            meta: {
              title: t('router.workflow'),
              icon: 'octicon:workflow-24',
              permission: 'Panda.Net.Basic.WorkFlowList'
            }
          },
          {
            path: '/workflow/create',
            component: () => import('@/views/workflow/create/index.vue'),
            name: 'WorkflowCreate',
            meta: {
              title: t('router.workflowCreate'),
              icon: 'carbon:workflow-automation',
              permission: 'Panda.Net.Basic.WorkFlowCreates'
            }
          },
          {
            path: '/workflow/update/:id',
            component: () => import('@/views/workflow/update/index.vue'),
            name: 'WorkflowUpdate',
            meta: {
              title: t('exampleDemo.edit'),
              icon: 'carbon:workflow-automation',
              hidden: true,
              permission: 'Panda.Net.Basic.WorkFlowList'
            }
          }
        ]
      },
      {
        path: '/agent',
        component: () => import('@/layout/index.vue'),
        name: 'Agent',
        meta: {
          title: t('router.agent'),
          icon: 'mdi:face-agent',
          permission: 'Panda.Net.Basic',
          hidden: true
        },
        redirect: '/agent/all',
        children: [
          {
            path: '/agent/all',
            component: () => import('@/views/agent/all/index.vue'),
            name: 'AllAgent',
            meta: {
              title: t('router.allAgent'),
              icon: 'material-symbols:real-estate-agent',
              permission: 'Panda.Net.Basic.AllAgent',
              hidden: true
            }
          }
        ]
      },
      {
        path: '/merchant',
        component: () => import('@/layout/index.vue'),
        name: 'Merchant',
        meta: {
          title: t('router.merchant'),
          icon: 'arcticons:wongnai-merchant',
          permission: 'Panda.Net.Basic',
          hidden: true
        },
        redirect: '/merchant/all',
        children: [
          {
            path: '/merchant/all',
            component: () => import('@/views/merchant/all/index.vue'),
            name: 'AllMerchant',
            meta: {
              title: t('router.allMerchant'),
              icon: 'arcticons:bemerchant',
              permission: 'Panda.Net.Basic.AllMerchant',
              hidden: true
            }
          }
        ]
      }
    ],
    //任意路由
    anyRoute: {
      path: '/:pathMatch(.*)*',
      redirect: '/404',
      name: 'Any',
      meta: {
        title: t('router.anyRouter'),
        hidden: true,
        icon: 'DataLine'
      }
    }
  };
};
